<?php
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

// No direct access

defined( '_JEXEC' ) or die( 'Restricted access' );

jimport('joomla.application.component.controller');

//require_once JPATH_COMPONENT.DS.'views'.DS.'worldmap'.DS.'view.php';

class Controller_admin extends JController {

/**
 * Custom Constructor
 */
    function __constuct( $default = array()) {
        parent::__construct( $default );
    }


    /**
     * Cancel operation
     */
    function cancel() {
        $this->setRedirect( 'index.php' );
    }


    function display() {
        //get model & view
        $model =& $this->getModel('Images');
	$view =& $this->getView( 'Admin' );

        //retrieve current images
        $images = $model->getImages();

        $view->display($images);
        //parent::display();
    }

    function confirm(){

        //retrieve ids parameter
        $ids = JRequest::getVar('ids');
        
        $model =& $this->getModel('Images');

        $details = array();
        foreach($ids as $id){
            array_push($details,$model->getImageDetails($id));
        }
        
        $view =& $this->getView('Confirm');
        $view->display($details);
    }

    /**
     * Display Main View
     *
     * @access    public
     */
    function displayMain() {
        parent::display();
        echo "ok";
    }

    /**
     * Display upload view
     */
    function displayUpload() {
        $view = new UploadView( );
        $view->display();
        echo "ok";
    }

}

